package com.gcxy.controller;


import com.gcxy.conf.result.R;
import com.gcxy.dto.AddUserDTO;
import com.gcxy.dto.EditUserDTO;
import com.gcxy.dto.LoginUserDTO;
import com.gcxy.dto.UserPageDTO;
import com.gcxy.service.IUserService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 * 用户表; 前端控制器
 * </p>
 *
 * @author author
 * @since 2024-12-25
 */
@RestController
@RequestMapping("/user")
@Api(value = "UserController" , tags = "用户管理控制器")
public class UserController {
	@Autowired
	private IUserService userService;


	@ApiOperation(value = "登录")
	@PostMapping("/login")
	public R login(@Validated @RequestBody LoginUserDTO loginUserDTO){
		return userService.login(loginUserDTO);
	}


	@ApiOperation(value = "退出登录")
	@PostMapping("/logout")
	public R logout(){
		return userService.logout();
	}


	@ApiOperation(value = "获取当前用户")
	@PostMapping("/getCurrentUser")
	public R getCurrentUser(){
		return userService.getCurrentUser();
	}

}
